export const barChart = {
  drawWord(id, data, width) {
    let echarts = window.echarts
    let chartDom1 = document.getElementById(id)
    chartDom1.style.width = width + 'px'
    let chart1 = echarts.init(chartDom1)
    chart1.clear()
    let option1 = {
      color: ['#3398DB'],
      tooltip: {
        trigger: 'axis',
        showDelay:0,
        axisPointer: {
          // 坐标轴指示器，坐标轴触发有效
          type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
        }
      },
      grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        top: '7%',
        containLabel: true
      },
      xAxis: [{
        type: 'category',
        data: data.name,
        axisTick: {
          show: false,
          alignWithLabel: true,
          color: '#ccc'
        },
        axisLine: {
          lineStyle: {
            color: '#ccc'
          }
        },
        axisLabel: {
          color: '#808080',
          rotate: 45
        }
      }],
      yAxis: [{
        type: 'value',
        axisLine: {
          lineStyle: {
            color: '#ccc'
          }
        },
        axisTick: {
          show: false
        },
        axisLabel: {
          color: '#808080'
        }
      }],
      series: [{
        name: '',
        type: 'bar',
        barWidth: '10%',
        itemStyle: {
          normal: {
            // eslint-disable-next-line
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
              offset: 0,
              color: '#20aeff'
            },
            {
              offset: 1,
              color: '#17a1ef'
            }
            ])
          }
        },
        data: data.value
      }]
      // dataZoom: {
      //   realtime:true,
      //   start:40,
      //   end:data.name.length
      // }
    }
    chart1.setOption(option1)
  },
  clearChart(id) {
    let echarts = window.echarts
    let myChart = echarts.init(document.getElementById(id))
    myChart.clear()
  }
}



// WEBPACK FOOTER //
// ./src/assets/js/chart/barChart.js